var Md5 = require('../../utils/md5.js');
var timeSecond = Math.floor(Date.now() * 0.001);  //获取时间戳: 
var SignInfoData = Md5.hexMD5(timeSecond + 'nativetalk')//md5加密;
var WxParse = require('../../wxParse/wxParse.js');
const app = getApp();
var httpNativetalk = app.globalData.httpNativetalk;
var httpWeike = app.globalData.httpWeike;
Page({
  data: {

  },
  onLoad: function () {
    var that = this;
    if (app.globalData.token == null) {
      wx.navigateTo({
        url: '/pages/bindPhone/bindPhone',
      })
    };
    if (app.globalData.token !== null) {
      wx: wx.request({
        url: httpWeike + '/v4.2/student/getWeikeVipPrice',
        data: {},
        header: {
          "Timestamp": timeSecond,
          "SignInfo": SignInfoData,
          "content-Type": "application/json",
          "client_type": "3",
          "version": 15,
          "token": app.globalData.token,
        },
        method: 'POST',
        dataType: 'json',
        success: function (res) {
          console.log(res)
          that.setData({
            weikeVipPrice: res.data.obj.weikeVipPrice,
          })
        },
        fail: function (res) { },
        complete: function (res) { },
      })
    }
  },
  becomeVipFun:function(e){
    console.log(e)
    var weikeVipPrice = e.currentTarget.dataset.vip;
    wx.navigateTo({
      url: '/pages/classBuy/classBuy?weikeVipPrice=' + weikeVipPrice + '&&set_amout=' + weikeVipPrice,
    });
  }
})